import Vue from "vue";
import VueRouter from "vue-router";
import Layout from "@/layout/Index.vue";
import Welcome from "@/views/Welcome.vue";
import UsersHistory from "@/views/users/History.vue";
import Users from "@/views/users/Index.vue";
import Test from "@/views/Test.vue";
import UsersCreate from "@/views/users/Create.vue";
import Auths from "@/views/auths/Index.vue";
import AuthsCreate from "@/views/auths/Create.vue";

import Roles from "@/views/roles/Index.vue";
import RolesCreate from "@/views/roles/Create.vue";
Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    component: Layout,
    children: [
      { path: "welcome", component: Welcome, alias: "/" },
      { path: "users/history", component: UsersHistory },
      { path: "users", component: Users },
      { path: "users/create", component: UsersCreate },

      { path: "roles", component: Roles },
      { path: "roles/create", component: RolesCreate },

      { path: "auths", component: Auths },
      { path: "auths/create", component: AuthsCreate },
    ],
  },
  {
    path: "/test",
    component: Test,
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
